package com.hunan.api.catv.entity.enums;

import org.springframework.util.ObjectUtils;

public enum TagType {
    columns(1, "栏目"),
    news(2, "资讯");

    private final Integer code;

    private final String msg;

    TagType(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static TagType getResult(int code) {
        if (ObjectUtils.isEmpty(code)) {
            return TagType.columns;
        }
        TagType[] rcs = TagType.values();
        for (TagType rc : rcs) {
            if (rc.getCode().equals(code)) {
                return rc;
            }
        }
        return null;
    }
}
